#!/usr/bin/perl -w
#
use warnings;
use strict;
  
# Open the input file
if (!open(MY_HANDLE, "in.txt")){ 
    die "Could not open in.txt"; 
}
#
# Get two DNA sequences from file 
our $seq1 = <MY_HANDLE>;chomp($seq1);
my @s1 = split(//,$seq1); 
my $seq2 = <MY_HANDLE>;chomp($seq2);
my @s2 = split(//,$seq2);

# Start the score at 0
my $score = 0; 
#Loop through the sequences
my $index =0;
while ($index<= $#s1){
    # if one nucleotide is different, increases score with 1
    if($s1[$index] ne $s2[$index]){
        $score++;
    }
    # else with 3
    else{
        $score = $score +3;
    }
     $index++;
}

           
# Open the output wile for writing
if(!open(WRITE_HANDLE, ">newFile.txt")){ 
    die "Could not open newFile.txt for writing"; 
}  
# Write out the score result
print(WRITE_HANDLE "$seq1 - $seq2 :$score"); 


 

